package com.qingke;

public class ChallengeDay4 {
	private static String str;
	private static String[] arr;
	public ChallengeDay4(){
		str="";
	}
	public ChallengeDay4(String s){
		str=s;
		arr=s.split(",");
	}
	public static void main(String[] args){
//		String str = "name:zjy,from:tonglu,like:sleep,job:programmer";
//		ChallengeDay4 c = new ChallengeDay4(str);
//		c.getStr();
//		c.delete("name");
//		c.getStr();
//		c.change("from", "fuyang");
//		c.getStr();
//		c.query("like");
		String qwe="";
		System.out.println(qwe.charAt(-1));
		
	}
	public void delete(String id){
		str="";
		for(String s:arr){
			str+=s.indexOf(id)>-1?"":s+",";
		}
		str=str.subSequence(0, str.length()-1).toString();
		arr=str.split(",");
	}
	public void change(String id,String content){
		str="";
		for(String s:arr){
			str+=s.indexOf(id)>-1?id+":"+content+",":s+",";
		}
		str=str.subSequence(0, str.length()-1).toString();
		arr=str.split(",");
	}
	public void query(String id){
		for(String s:arr){
			if(s.indexOf(id)>-1){
				System.out.println(s.substring(id.length()+1));
			}			
		}
	}
	public void getStr(){
		System.out.println(str);
		//System.out.println(arr.length);
	}
}
